<template>
	<view class="list-content">
		<view v-for="(value, index) in listData" :key="index" @touchstart="showDeleteButton(value)" @touchend="emptyTime">
			<view class="uni-list-cell" hover-class="uni-list-cell-hover" @click="checkBaseInfo(value)">
				<view class="uni-media-list">
					<view class="uni-media-list-body">
						<view class="uni-media-list-text-top">
							<text style="font-size: 28rpx; font-weight: bold; margin-right: 20rpx">{{ value.customerName }}</text>
							<text style="font-size: 24rpx">负责人：{{ value.ownerUserName || '--' }}</text>
						</view>
						<view class="uni-media-list-content">
							<view>
								<view>下次联系时间：{{ value.nextTime || '--' }}</view>
								<view>设备台数：{{ value.equipmentNum || '无' }}</view>
								<view> {{ value['客户来源'] || '--' }} / {{ value['客户行业'] || '--' }} / {{ value['客户标签'] || '--' }} </view>
							</view>
							<view class="uni-media-tag">
								<!-- <view style="padding: 0 20rpx; border-radius: 5px" :style="{ border: getStatusStyle(value, 1), backgroundColor: getStatusStyle(value, 2), color: getStatusStyle(value, 3) }">{{ getStatusName(value) }}</view> -->
								<u-tag plain size="mini" :type="$enum.status[value.checkStatus].type" :text="$enum.status[value.checkStatus].text"></u-tag>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapGetters } from 'vuex';
import common from '../../mixins/common.js';

export default {
	data() {
		return {
			Loop: null,
		};
	},
	props: {
		listData: {
			type: Array,
			default: {
				return: [],
			},
		},
		crmType: {
			type: String,
			default: '',
		},
		test: Boolean,
	},
	mixins: [common],
	filters: {
		filterUserName(name) {
			if (name) {
				return name.substring(name.length - 2, name.length);
			}
		},
	},
	watch: {},
	computed: {
		...mapGetters(['crm']),
	},
	created() {
		// this.checkAuthToShow();
	},
	methods: {
		checkFollowRecord(item) {
			uni.navigateTo({
				url: '/pages/customerManagement/followRecord/followRecordInfo?recordId=' + item.recordId,
			});
		},

		showDeleteButton: function (value) {
			clearTimeout(this.Loop); //再次清空定时器，防止重复注册定时器
			this.Loop = setTimeout(
				function () {
					this.$emit('touch-change', value);
				}.bind(this),
				500
			);
		},

		emptyTime: function () {
			clearTimeout(this.Loop); //清空定时器，防止重复注册定时器
		},
	},
};
</script>

<style lang="scss" scoped>
@import '@/pages/customerManagement/styles/list.scss';

.list-content {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.uni-media-list-text-top {
	justify-content: space-between;
}

.uni-media-list-content {
	width: 100%;
	display: flex;
	justify-content: space-between;
}

.uni-media-tag {
	display: flex;
	justify-content: flex-end;
	align-items: center;
}
</style>
